﻿/* PN264 - A Parallel H.264 Encoding Utility
 * Copyright © 2009 PN264 Development Team
 *
 * This software is released the terms and conditions of the MIT License,
 * a copy of which can be found in the License.txt file.
 *
 * Contributors:
 * Will 'AnarkiNet' Shelley (AnarkiNet@gmail.com)
 */
using System;
using System.Windows.Forms;
using PN264.Dialogs;

namespace PN264
{
    /// <summary>
    /// Provides the main PN264 user interface form.
    /// </summary>
    public partial class PN264UI : Form
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="PN264UI"/> class.
        /// </summary>
        public PN264UI()
        {
            InitializeComponent();
        }
        #endregion
        #region Methods
        private void UserChangeWorkerCount(int workerCount)
        {

        }
        private void trayMinimizeMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
        }
        private void fileExitMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        /// <summary>
        /// Raises the <see cref="Control.VisibleChanged"/> event.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnVisibleChanged(EventArgs e)
        {
            base.OnVisibleChanged(e);

            this.trayUI.Visible = !this.Visible;
        }
        private void showForm_Click(object sender, EventArgs e)
        {
            this.Show();
        }
        private void nSynthEToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("This feature is not yet implemented, sorry!");
        }
        private void configureWorkersMenuItem_Click(object sender, EventArgs e)
        {
            using (WorkerConfigurationDialog dialog = new WorkerConfigurationDialog())
            {
                var result = dialog.ShowDialog();

                if (result == DialogResult.OK)
                {
                    WorkerPool.Capacity = dialog.SelectedWorkerCount;
                }
            }
        }
        private void trayUI_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            this.Show();
        }
        #endregion

    }
}
